package com.cloudxingkong.dianyinke.NewTeacher.Utils;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * Created by LeeQ on 2016/4/15.
 */
public class THomePicJsonUtils {
    public static List<HashMap<String,String>> getPathFormJson(String json){
        List<HashMap<String,String>> data;

        try {
            data=new ArrayList<>();
            JSONArray array=new JSONArray(json);
            for (int i = 0; i < array.length(); i++) {
                JSONObject o1=array.getJSONObject(i);
                HashMap<String,String> map=new HashMap<>();
                map.put("path",o1.getString("path"));
                map.put("filename",o1.getString("filename"));
                data.add(map);
            }
            return data;
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }
}
